package org.nvframe.component.property.operation;

public class Percentage implements Operation {

	private int percentageValInt;
	private float percentageValFloat;
	private double percentageValDouble;
	
	public Percentage(int percentageVal) {
		this.percentageValInt = percentageVal;
	}	
	
	public Percentage(float percentageVal) {
		this.percentageValFloat = percentageVal;
	}
	
	public Percentage(double percentageVal) {
		this.percentageValDouble = percentageVal;
	}
	
	@Override
	public int getResult(int orgVal) {
		return Math.round((float) orgVal * (float) percentageValInt / 100);
	}

	@Override
	public float getResult(float orgVal) {
		return Math.round(orgVal * percentageValFloat / 100);
	}

	@Override
	public double getResult(double orgVal) {
		return Math.round((double) orgVal * percentageValDouble / 100);
	}
}
